UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mSgkIzdutuoXyLSI1Afn6v5j7sGZXODLZLpeTiO5hi4=' 
WHERE 
  key_id = '10d218b2035002f8b4e0f3a0f095ed4f6ecb40c06bc9a5b7c944c664c11d8ba1' 
  AND (
    token = 'mSgkIzdutuoXyLSI1Afn6v5j7sGZXODLZLpeTiO5hi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015