UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RMS/oyDeGQqec0eC9X5tURQz2JVOSCJb9ekfuiXaOWs=' 
WHERE 
  key_id = '96b416a3bc8d0f0cb1f9976d6686b0115099bec40c40689fa453b40bedc4015e' 
  AND (
    token = 'RMS/oyDeGQqec0eC9X5tURQz2JVOSCJb9ekfuiXaOWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034