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