UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e7uWpkCIQEVHqqpSvEDXzy5Hxd02YqKaENIosaAKLnk='
WHERE
key_id = '776ab63ff8003113b62bf2ed85ad56a1c40c220bb5d01ad9bca7721265826e7c'
AND (
token = 'e7uWpkCIQEVHqqpSvEDXzy5Hxd02YqKaENIosaAKLnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)