UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WydF4pcs3Q/S+0cgkqiBmcsDyy16uADhEaqIku9pG6U='
WHERE
key_id = 'cf27a5f836a1e37b003bd42084e3c9b9854e948a516690b1e51a9d06f028ca88'
AND (
token = 'WydF4pcs3Q/S+0cgkqiBmcsDyy16uADhEaqIku9pG6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)