UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's7U8eBqXlMoJhfvVlkR3ZUZLXDmdiWuAft49dDFJwR0='
WHERE
key_id = '5d774a1bc812083c487a13af87b176da6a58182bb5975150d00512893b51c3b6'
AND (
token = 's7U8eBqXlMoJhfvVlkR3ZUZLXDmdiWuAft49dDFJwR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)