UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iu4gjaHAO+j+TyZeGpMHVMtjgDl1TMizE5y0hV5CEj4=' 
WHERE 
  key_id = 'b270797242fa7deaa1baecafa3e4f51a44e92cc3a3ff9a94d168b4cd85456123' 
  AND (
    token = 'iu4gjaHAO+j+TyZeGpMHVMtjgDl1TMizE5y0hV5CEj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042