UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SCo2aZIP7keNMfDBHoIFIYona/PTOH0fGV6U7AVWu1E='
WHERE
key_id = '7c500e8e8bed9cc8af14b9e3b302fa4e41a56ed92e90ed7db456ea15488298de'
AND (
token = 'SCo2aZIP7keNMfDBHoIFIYona/PTOH0fGV6U7AVWu1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)