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