UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ySPMztgcWUf2Z3bkEXvBkoop18IYoLkuH+tPAxXwIzs=' 
WHERE 
  key_id = 'f352c2b29a552a9f987c615988df41a2149b3070cc71a893d383d8512f98ddf8' 
  AND (
    token = 'ySPMztgcWUf2Z3bkEXvBkoop18IYoLkuH+tPAxXwIzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030