UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eWZMvNvnNo3IOg3/GMTI8yHct7MwsyQj5s9Z3gKm8m4=' 
WHERE 
  key_id = '3e786ba6a2c32252305e96e7732fef6f142acd57d5e15af07916df2d6edd1516' 
  AND (
    token = 'eWZMvNvnNo3IOg3/GMTI8yHct7MwsyQj5s9Z3gKm8m4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046