UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '87oVF3NWuWNNWpWAf7ZR+ylpo4IaoklJjaEzSnxEd5A='
WHERE
key_id = 'f40ce598c2502942a4818b4974444b0f618db2f782efd69b20adaa10e33d1764'
AND (
token = '87oVF3NWuWNNWpWAf7ZR+ylpo4IaoklJjaEzSnxEd5A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)