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