UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f1j/OrQCjIcGYUcL3WK0upLnziM/alESJzrrJ4Iv/Oo='
WHERE
key_id = 'e866f81a1a75af56d294b8be15b2401b9c79b28250de048be22becdb56473f8e'
AND (
token = 'f1j/OrQCjIcGYUcL3WK0upLnziM/alESJzrrJ4Iv/Oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)