UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6NsSqepJ1ywmRvyRZUECcRIteLDelrtHRAQXlpUsnrY='
WHERE
key_id = '4c2d66fe04b04baf0a27ab20be45bbd1ca7e9f4d3ae2f9fd71982d42e0ce9c44'
AND (
token = '6NsSqepJ1ywmRvyRZUECcRIteLDelrtHRAQXlpUsnrY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)