UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5/Axb7pBAX0kMz0CGmon9TZd+5ek+dx7MENnAawgYYg=' 
WHERE 
  key_id = 'a1f2f8050dcf7c0251a429bf2287e7ee608f69b702e2f297b607c9f4d498691c' 
  AND (
    token = '5/Axb7pBAX0kMz0CGmon9TZd+5ek+dx7MENnAawgYYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031