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