UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wYnIPm5HOfiXa7rPvPOIyresRUgyBkoHoy1poFXiVBA='
WHERE
key_id = '12c56c03220cbc0b06a634a62e87f26b600c90faee7f83d6dd6317c0da342f2b'
AND (
token = 'wYnIPm5HOfiXa7rPvPOIyresRUgyBkoHoy1poFXiVBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)