UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZedaKswgqjVP9p2FCH4EJoUIV+Qi3wEIr7NgspdzoO0='
WHERE
key_id = 'f37b5c56a04ea5f18144b55a52fc8a1086a8ccdbc2f212ee8ef4c6b7ebdafca1'
AND (
token = 'ZedaKswgqjVP9p2FCH4EJoUIV+Qi3wEIr7NgspdzoO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)