UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S/4zbb8goPa9TxEvdnri37jRrMDw0Xv7dbO3fwbzwWM='
WHERE
key_id = '6807b5ad693e5b7469f73543ea11c925fa9ad33751a8cbc4701b408e20e373e5'
AND (
token = 'S/4zbb8goPa9TxEvdnri37jRrMDw0Xv7dbO3fwbzwWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)