UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yojJAPDtJVYTNyGmGKvN9Eq2g4d2CDIkcbDuIikjl8Y='
WHERE
key_id = 'd106ce369b0487f277b6580e0346179f189e14643d82dad5bb97c67d750cf3e4'
AND (
token = 'yojJAPDtJVYTNyGmGKvN9Eq2g4d2CDIkcbDuIikjl8Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)