UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EvXYdXGhzzJIjF0XLpIc18M2va5jE5RSDgnjHyh29Rw='
WHERE
key_id = 'fa8ce07f2f2d711a5788e438a124ef355834a23116e3b1c0fca3be342b61e199'
AND (
token = 'EvXYdXGhzzJIjF0XLpIc18M2va5jE5RSDgnjHyh29Rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)