UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjkYefahHNPEpePQgKELvjz5S4PU7Q8wviLR4sEdqi0=' 
WHERE 
  key_id = '513c46979a36529c7987325fe9b860e719ee31fcfe3adfef2e511b9520271a4c' 
  AND (
    token = 'BjkYefahHNPEpePQgKELvjz5S4PU7Q8wviLR4sEdqi0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058