UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UzmjWlKD+L44WOEWeelLg6l3NzTsydoHz9mU5onYaf0=' 
WHERE 
  key_id = 'f1ffd21c56046749c58ca75a5f29e410e9824a56c1966d256085bffe205b7208' 
  AND (
    token = 'UzmjWlKD+L44WOEWeelLg6l3NzTsydoHz9mU5onYaf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038