UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BGybrmAdgWkZcTJZUUYFGyn86Lfa3/Jh5thdPWuQEKo=' 
WHERE 
  key_id = 'ad8ffb868162c017198042cd3619ca2cab1e1e827b8524707f2bbece251f22db' 
  AND (
    token = 'BGybrmAdgWkZcTJZUUYFGyn86Lfa3/Jh5thdPWuQEKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043