UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Npkk691pI0yvyCRkFz7cpXnN0PvS2kPr41neyw/JD3U=' 
WHERE 
  key_id = 'dd127fb4c04f140193c1b61646c0e40a400a72f57dcf0a9b4f288465d86eb008' 
  AND (
    token = 'Npkk691pI0yvyCRkFz7cpXnN0PvS2kPr41neyw/JD3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040