UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hniGRxI+Zq2399sxUCGZUWq1UudEYJYCczfW2X7Km6w=' 
WHERE 
  key_id = '46cbc9a3e230ea4a73880aeb02c2a1b3a5c5fc9165a7d93b9f115d1d58d1e72d' 
  AND (
    token = 'hniGRxI+Zq2399sxUCGZUWq1UudEYJYCczfW2X7Km6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028