UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RD0TMBucTS2yPOrwGnK8QTPwAw+m7Azz9xMf89DJgl8=' 
WHERE 
  key_id = 'cc31807f5d7fbfd3475a542e0b7d98193c8ae8c054b1ccac61c2ed917a4a9e40' 
  AND (
    token = 'RD0TMBucTS2yPOrwGnK8QTPwAw+m7Azz9xMf89DJgl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032