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