UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5CY9SU9xpqToV+StGbRT7jEsLdG5VuXjkTUrVTdsVeY='
WHERE
key_id = '836ae343bab06a20dd5e1b6b81dfd41f373459159b6b779eb0c02b02d1057a49'
AND (
token = '5CY9SU9xpqToV+StGbRT7jEsLdG5VuXjkTUrVTdsVeY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)