UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hgzt6+Xfp8z7BTdf7W2DehCzIVyduneZz5B6qEMRiM4=' 
WHERE 
  key_id = '329689303986ffdad07b817515b2f17a55e8dfc5ab59d5303d9e3063c531d1b1' 
  AND (
    token = 'Hgzt6+Xfp8z7BTdf7W2DehCzIVyduneZz5B6qEMRiM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039