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

Query time 0.00040