UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IYdLSDFTzuAzNxrNj5JwGiisFeD0fOUIf9GnDWRG0vU='
WHERE
key_id = '0c619971e4c852d9736d1b1713a10efaf4804c280a914aa2f0173a45f21348fe'
AND (
token = 'IYdLSDFTzuAzNxrNj5JwGiisFeD0fOUIf9GnDWRG0vU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)