UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3msNJeOA2voP1YNXzgHhCDgeuz680ZseSnGu7maeFh4='
WHERE
key_id = '7f09ca9495b0b58b33085489dd0ccb4ec326f773c86e1d8cc2b28d39e2774c8c'
AND (
token = '3msNJeOA2voP1YNXzgHhCDgeuz680ZseSnGu7maeFh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)