UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c6/247rAVKiDXWNBwz29Lns56R+MotEkbi0bW5YnVic=' 
WHERE 
  key_id = '9cbb90487dc2708d60042020a65104f9e8f664eda1e4bab2d903351f1b707d38' 
  AND (
    token = 'c6/247rAVKiDXWNBwz29Lns56R+MotEkbi0bW5YnVic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021