UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hbJfU4/BVKXJ3Wsw5xj3nFYmAo3qE5In+RRNON1E8Y8=' 
WHERE 
  key_id = 'b3558d82702bc70df88360d6cf74b5f27a1a555cd364a4352de240e06f899b0b' 
  AND (
    token = 'hbJfU4/BVKXJ3Wsw5xj3nFYmAo3qE5In+RRNON1E8Y8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025